﻿using System;
using EnvDTE;
using System.Collections.Generic;

namespace CodeCounsel.SharePoint.DevTools.ProjectTypes
{
    class DefaultCertificateGenerator 
        : ICertificateGenerator
    {
        bool _strongNameGenerated;
        ProjectManager projectManager = new ProjectManager();

        public void AddKeyFile(Project project)
        {
            if (this._strongNameGenerated)
            {
                this.projectManager.AddKeyFileToProject(project);
                this._strongNameGenerated = false;
            }
        }

        public void GenerateKeyFile(Dictionary<string, string> replacementsDictionary)
        {
            this.projectManager.GenerateKey();
            this.projectManager.AddKeyToDictionary(replacementsDictionary);
            this._strongNameGenerated = true;
        }
    }
}